package com.huawei.appgallery.assistantdock.buoydock.card.card;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.huawei.appgallery.assistantdock.base.cardkit.card.BuoyBaseCard;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.serverreqkit.api.bean.startup.StartupResponse;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import o.beo$e;
import o.beq;
import o.bfs;
import o.bgf;
import o.bgj;
import o.cgz;
import o.chy;
import o.eqx;
import o.evx;
import o.fae;
import o.fam;

public class BuoyLanternItemCardBuoy extends BuoyBaseCard {
    private ImageView ˏ;

    public BuoyLanternItemCardBuoy(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        this.ˏ = (ImageView) view.findViewById(beo$e.ﹳ);
        ॱ((TextView) view.findViewById(beo$e.ʽˋ));
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        eqx.ˏ(this.ˏ, ((BaseCardBean) cardBean).ॱˌ(), "circle_default_icon");
    }

    public void ॱ(final chy o_chy) {
        ˉ().setOnClickListener(new evx(this) {
            final /* synthetic */ BuoyLanternItemCardBuoy ˊ;

            public void ˋ(View view) {
                if (this.ˊ.ॱॱ()) {
                    bgf.ˊ().ॱ(this.ˊ.ʼॱ, this.ˊ.ˊᐝ.ॱॱ());
                    if (this.ˊ.ˊᐝ instanceof BaseCardBean) {
                        beq.ˎ((BaseCardBean) this.ˊ.ˊᐝ);
                    }
                } else if (this.ˊ.ᐝ()) {
                    bgf.ˊ().ˊ(this.ˊ.ʼॱ, this.ˊ.ˊᐝ.ॱॱ());
                    if (this.ˊ.ˊᐝ instanceof BaseCardBean) {
                        beq.ˎ((BaseCardBean) this.ˊ.ˊᐝ);
                    }
                } else if (this.ˊ.ʽ()) {
                    this.ˊ.ˋ();
                    if (this.ˊ.ˊᐝ instanceof BaseCardBean) {
                        beq.ˎ((BaseCardBean) this.ˊ.ˊᐝ);
                    }
                } else if (this.ˊ.ॱˊ()) {
                    this.ˊ.ˊ();
                    if (this.ˊ.ˊᐝ instanceof BaseCardBean) {
                        beq.ˎ((BaseCardBean) this.ˊ.ˊᐝ);
                    }
                } else {
                    o_chy.ˏ(0, this.ˊ);
                }
                if (this.ˊ.ˊᐝ != null && !TextUtils.isEmpty(this.ˊ.ˊᐝ.ॱॱ())) {
                    beq.ˊ(this.ˊ.ˊᐝ.ॱॱ());
                    beq.ˏ(StartupResponse.CHANNELNO_QUERY_FAILURE, "CLICK", this.ˊ.ʻ(), "CONTENT");
                }
            }
        });
    }

    private void ˋ() {
        if (UserSession.getInstance().isLoginSuccessful()) {
            fae ˏ = fam.ॱ().ˏ();
            if (ˏ != null) {
                GameInfo gameInfo = ˏ.getGameInfo();
                if (gameInfo != null) {
                    new bgj().ˊ(this.ʼॱ, gameInfo.getPackageName());
                    return;
                }
                return;
            }
            return;
        }
        bfs.ˋ().ॱ(this.ʼॱ);
    }

    private void ˊ() {
        if (UserSession.getInstance().isLoginSuccessful()) {
            fae ˏ = fam.ॱ().ˏ();
            if (ˏ != null) {
                GameInfo gameInfo = ˏ.getGameInfo();
                if (gameInfo != null) {
                    new bgj().ˎ(this.ʼॱ, gameInfo.getPackageName());
                    return;
                }
                return;
            }
            return;
        }
        bfs.ˋ().ॱ(this.ʼॱ);
    }

    private String ʻ() {
        if (ᐝ() || ॱॱ()) {
            return "lantern_forum";
        }
        if (ͺ()) {
            return "lantern_gift";
        }
        if (ˋॱ()) {
            return "lantern_campaign";
        }
        if (ʽ()) {
            return "achievement";
        }
        if (ॱˊ()) {
            return "ranking";
        }
        return this.ˊᐝ.ॱॱ();
    }

    private String ʼ() {
        if (this.ˊᐝ == null) {
            return "";
        }
        String ॱॱ = this.ˊᐝ.ॱॱ();
        if (TextUtils.isEmpty(ॱॱ)) {
            return "";
        }
        int indexOf = ॱॱ.indexOf(124);
        if (indexOf != -1) {
            return ॱॱ.substring(0, indexOf);
        }
        return ॱॱ;
    }

    private boolean ᐝ() {
        return "buoy_forum".equals(ʼ());
    }

    private boolean ॱॱ() {
        return "forum".equals(ʼ());
    }

    private boolean ʽ() {
        if (this.ˊᐝ == null) {
            return false;
        }
        Object ॱॱ = this.ˊᐝ.ॱॱ();
        if (TextUtils.isEmpty(ॱॱ)) {
            return false;
        }
        return ॱॱ.startsWith("buoy_client|achievement");
    }

    private boolean ॱˊ() {
        if (this.ˊᐝ == null) {
            return false;
        }
        Object ॱॱ = this.ˊᐝ.ॱॱ();
        if (TextUtils.isEmpty(ॱॱ)) {
            return false;
        }
        return ॱॱ.startsWith("buoy_client|leaderboard");
    }

    private boolean ͺ() {
        if (this.ˊᐝ == null) {
            return false;
        }
        Object ॱॱ = this.ˊᐝ.ॱॱ();
        if (TextUtils.isEmpty(ॱॱ)) {
            return false;
        }
        return ॱॱ.startsWith("buoy_gss|gifts_list");
    }

    private boolean ˋॱ() {
        if (this.ˊᐝ == null) {
            return false;
        }
        Object ॱॱ = this.ˊᐝ.ॱॱ();
        if (TextUtils.isEmpty(ॱॱ)) {
            return false;
        }
        return ॱॱ.startsWith("buoy_gss|campaign_list");
    }
}
